//
// CommonDefines.c
//
//  WoW Atlas, a World of Warcraft instance map, loot, and achievement browser.
//  Copyright 2010 Steven Mattera <stevenmattera@gmail.com>
//
//	Special Thanks to Dan Gilbert and the Atlas/Atlasloot Team.
//
//	WoW Atlas is free software; you can redistribute it and/or modify
//	it under the terms of the GNU General Public License as published by
//	the Free Software Foundation; either version 2 of the License, or
//	(at your option) any later version.
//
//	WoW Atlas is distributed in the hope that it will be useful,
//	but WITHOUT ANY WARRENTY; without even the implied warrenty of
//	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//	GNU General Public License for more deails.
//
//	You should have received a copy of the GNU General Public License
//	along with WoW Atlas; if not, write to the Free Software
//	Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//

#include "CommonDefines.h"

void CGContextAddRoundRect(CGContextRef context, CGRect rect, CGFloat cornerRad) {
	CGContextMoveToPoint(context, rect.origin.x, cornerRad);
	
	CGContextAddArcToPoint(context,
						   rect.origin.x,
						   rect.origin.y,
						   rect.origin.x + cornerRad,
						   rect.origin.y,
						   cornerRad);
	
	CGContextAddArcToPoint(context,
						   rect.origin.x + rect.size.width,
						   rect.origin.y,
						   rect.origin.x + rect.size.width,
						   rect.origin.x + cornerRad,
						   cornerRad);
	
	CGContextAddArcToPoint(context,
						   rect.origin.x + rect.size.width,
						   rect.origin.y + rect.size.height,
						   rect.origin.x + rect.size.width - cornerRad,
						   rect.origin.y + rect.size.height,
						   cornerRad);
	
	CGContextAddArcToPoint(context,
						   rect.origin.x,
						   rect.origin.y + rect.size.height,
						   rect.origin.x,
						   rect.origin.y,
						   cornerRad);
	
	CGContextClosePath(context);
}
